<!--********************* Part1:Jsp Head *********************-->

<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>  
<%@ include file="/framework/head.jsp"%>

<!--********************* Part2:Java Code *********************-->
<%
	ProductTypeManagerPageData obj = (ProductTypeManagerPageData)context.getValue("ProductTypeManagerPageData");
%>

<!--********************* Part3:JavaScript Code ***************-->
<script language="javascript">

var g_check_items = new Array();
var g_i = 0 ;

g_check_items[g_i++] = new CheckItem("分类名称","TypeName",true,true,50,false,0);

function doSaveAndNew()
{
	if(!CheckInput(g_check_items)) return false;
	SetAction("saveAndNewProductTypeManager");
	frm.submit();
}
function doSave()
{
	if(!CheckInput(g_check_items)) return false;
	SetAction("saveProductTypeManager");
	frm.submit();
}
function doCancel()
{
	SetAction("backListProductTypeManager");
	frm.submit();
}

key_InitDefault();
key_RegSubmitHandler(doSaveAndNew);
</script>

<%=uiBody%>>

<!--********************* Part4:Form  ***************-->

<form id=frm action="<%=Config.getSrv()%>" method="post">
<input type=hidden name="action_code">

<input type=hidden name="Id" value="<%=obj.getId()%>">


<%=UIManager.addEditHeadTitle("添加或修改产品统计分类")%>


<!--********************* Part5:Edit Area  ***************-->
<%=uiEditStart%>>
<%
	int key_tab = 1 ;
%>

  	<%=uiEditTR%>>
		 <%=uiEditHeadTD%> width=250>分类名称：</td>
		 <%=uiEditTD%>> 
		 	  <input type=text class="texts"  name="TypeName" size=20  value="<%=obj.viewTypeName(con)%>" key_tab="<%=key_tab++%>"><font color=red>*</font>
		 </td>
  	</tr>
  	<%=uiEditTR%>>
		 <%=uiEditHeadTD%> width=250>上一级种类编号：</td>
		 <%=uiEditTD%>> 
		 <%	if(obj.viewUpperType(con)==null||obj.viewUpperType(con).equals("")){ %>
		
		 		<select name="UpperType">			
				    
				     <%
				     	Conditions condition = new Conditions();
				     	condition.add("type_level = 1 and status = 1");
				     	ObjectList list = ProductTypeManager.fetch().search(con,condition);
				     	for(int i=0;i<list.size();i++){
							ProductTypeManager productType = (ProductTypeManager)list.get(i);
				      %>	
				      	 <option value="<%=productType.getProductType() %>"><%=productType.getTypeName() %></option>	
				      <%
				      	}
				       %>
				</select>
				 <% }else{
				 	Conditions condition = new Conditions();
				   	condition.add("product_type ="+obj.viewUpperType(con));
				 	ObjectList list = ProductTypeManager.fetch().fetch().search(con,condition);
				 	if(list.size()>0){
				 		ProductTypeManager productType = (ProductTypeManager)list.get(0);
				 		out.print(productType.getProductType()+",父类名称为"+productType.getTypeName());
				 	}
				 %>
				 		
				 <%} %>
		 </td>
  	</tr>
  	<%=uiEditTR%>>
		  <%=uiEditHeadTD%> width=250>是否有效：</td>
		 <%=uiEditTD%>> 
		 	<select name="Status">
		 			<%
		 				if(obj.viewStatus(con).equals("0")){
		 			 %>	
		 				<option value="0">无效</option>
		 			 	<option value="1">有效</option>	
					<%
						}else{		
					%>
						<option value="1">有效</option>	
		 				<option value="0">无效</option>
					<%
						}	
					%>
				</select>
		 </td>
  	</tr>
  	<%=uiEditTR%>>
		 <%=uiEditHeadTD%> width=250>备注：</td>
		 <%=uiEditTD%>> 
		 	  <input type=text class="texts"  name="Remark" size=20  value="<%=obj.viewRemark(con)%>" key_tab="<%=key_tab++%>">
		 </td>
  	</tr>
<%=uiEditEnd%>

<!--********************* Part6:Action Area  ***************-->
<%=uiCommandStart%>>
	<%=uiCommandTR%>>
   		<%=uiCommandTD%>>                     
			<input type=button class="buttons" value=" 保存&添加 " onclick="doSaveAndNew();return false;">
			<input type=button class="buttons" value="    保存   " onclick="doSave();return false;">
			<input type=button class="buttons" value="    返回   " onclick="doCancel();return false;">
		</td>
	</tr>
<%=uiCommandEnd%>
</form>

<%@ include file="/framework/foot.jsp"%>
